import java.awt.Point;
import java.util.ArrayList;
import java.util.Scanner;


public class PopStarReduce
{
	private static int[][] content;
	private static boolean[][] markTable;
	private ArrayList<Point> set;
	public PopStarReduce()
	{
		content = new int[12][12];
		markTable = new boolean[12][12];
		for (int i = 0; i < 12; i++)
		{
			for (int j = 0; j < 12; j ++)
			{
				content[i][j] = -1;
				markTable[i][j] = false;
			}
		}
	}
	
	private void clearMarkTable()
	{
		for (int i = 0; i < 12; i++)
		{
			for (int j = 0; j < 12; j ++)
			{
				markTable[i][j] = false;
			}
		}
	}
	
	public void getInput()
	{
		Scanner input = new Scanner(System.in);
		
		for (int i = 0; i < 10; i++)
		{
			for (int j = 0; j < 10; j++)
			{
				content[1 + i][1 + j] = input.nextInt();
			}
		}
		input.close();
	}
	
	public void find()
	{
		for (int i = 1; i < 11; i++)
		{
			for(int j = 1; j < 11; j++)
			{
				if (content[i][j] == -1)
				{
					continue;
				}
				else
				{
					ArrayList<Point> ps = new ArrayList<Point>();
					if(valiable(i, j, ps))
					{
						System.out.println(i + ":" + j + "= " + ps.size());
						clearMarkTable();
					}
				}
			}
		}
	}
	
	private boolean valiable(int x, int y, ArrayList<Point> set)
	{
		this.set = set;
		return countSameBlock(x, y) > 1;
	}
	
	private int countSameBlock(int i, int j)
	{
		if (i < 1 || j < 1 || i > 10 || j > 10)
		{
			return 0;
		}
		
		markTable[i][j] = true;
		set.add(new Point(i, j));
		if (!markTable[i - 1][j] && content[i - 1][j] == content[i][j])
		{
			countSameBlock(i - 1, j);
		}
		if (!markTable[i + 1][j] && content[i + 1][j] == content[i][j])
		{
			countSameBlock(i + 1, j);
		}
		if (!markTable[i][j - 1] && content[i][j - 1] == content[i][j])
		{
			countSameBlock(i, j - 1);
		}
		if (!markTable[i][j + 1] && content[i][j + 1] == content[i][j])
		{
			countSameBlock(i, j + 1);
		}
		
		return set.size();
	}
	
	public static void main(String[] args)
	{
		PopStarReduce psr = new PopStarReduce();
		psr.getInput();
		psr.find();
	}
}
